package com.lepu.app.fun.my.bean;

import android.content.ContentValues;

import com.app.utils.DBHelper;
import com.core.lib.utils.main.UtilityBase;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class BeanMessage {

    /**
     * LinkTargetType
     * 1  用户
     2 论坛
     3 活动
     4优惠券
     5陪诊
     6转诊
     100 跳转url 类型
     */
    public String PSMID;   //消息id
    public String MessageTitle;   //消息标题
    public String MessageContent;   //消息内容
    public String MessageTime;   //消息时间
    public String LinkTargetType;   //连接类型
    public String LinkTargetID;   //目标id
    public String LinkURL;   //原文

    public static ArrayList<BeanMessage> parseListInfo(String dataString) {
        String result = "";
        try {
            JSONObject jsonObject = new JSONObject(dataString);
            JSONObject obj1 = (JSONObject) jsonObject.get("Result");
            JSONArray dataArray = obj1.getJSONArray("ListInfo");

            result = dataArray.toString();
        } catch (JSONException e) {
            e.printStackTrace();
        }

        Gson gson = new Gson();
        ArrayList<BeanMessage> dataList = gson.fromJson(result,
                new TypeToken<List<BeanMessage>>() {
                }.getType());
        return dataList;
    }
}
